package com.puzzletest.bean;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

public class ImageInfoList {
	private General general = new General();
	public static final String DATA = "data";
	private List<ImageInfo> list = new ArrayList<ImageInfo>();

	public ImageInfoList(){
	}

	public ImageInfoList(JSONObject jsonObject){
		fromJson(jsonObject);
	}
	
	private void fromJson(JSONObject jsonObject) {
		if(jsonObject == null || jsonObject.equals("")){
			return;
		}
		
		try {
			setGeneral(new General(jsonObject));
			if(getGeneral().getStatus() == 1){
				JSONArray ja = jsonObject.getJSONArray(DATA);
				for (int i = 0; i < ja.length(); i++) {
					list.add(new ImageInfo(ja.getJSONObject(i)));
				}
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public General getGeneral() {
		return general;
	}

	public void setGeneral(General general) {
		this.general = general;
	}

	public List<ImageInfo> getList() {
		return list;
	}

	public void setList(List<ImageInfo> list) {
		this.list = list;
	}

}
